package com.wandian.view.item
{
	
	import com.wandian.core.BitmapManager;
	
	import flash.display.MovieClip;
	import flash.display.Sprite;

	/**
	 * 鼠标点击寻路时效果 
	 * @author leo
	 * 
	 */	
	public class MouseClickEffect extends Sprite
	{
		private var mc :MovieClip;
		public function MouseClickEffect()
		{
			super();
			
			
			mc = BitmapManager.instance.getMCByName("mouseClick");
			if(!mc)
			{
				return;
			}
			this.addChild(mc);
			hideEffect();
		}
		
		public function showEffect():void
		{
			this.visible = true;
			mc.gotoAndPlay(1);
			mc.addFrameScript(mc.totalFrames - 1,playEndHandler);
		}
		
		public function hideEffect():void
		{
			this.visible = false;
			mc.gotoAndStop(mc.totalFrames -1);
			mc.addFrameScript(0,null);
		}
		
		private function playEndHandler():void
		{
			this.visible = false;
			this.mc.gotoAndStop(mc.totalFrames -1);
			mc.addFrameScript(0,null);
		}
	}
}